.class public Les/t80;
.super Ljava/lang/Object;
.source "ESTaskMgr.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Les/t80$c;
    }
.end annotation


# static fields
.field private static final g:Ljava/lang/String;

.field private static h:Les/t80;


# instance fields
.field private a:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Lorg/json/JSONObject;",
            ">;"
        }
    .end annotation
.end field

.field private b:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList<",
            "Les/s80;",
            ">;"
        }
    .end annotation
.end field

.field private c:Landroid/util/SparseArray;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/SparseArray<",
            "Ljava/util/List<",
            "Les/s80;",
            ">;>;"
        }
    .end annotation
.end field

.field private d:Les/t80$c;

.field public final e:Les/z80;

.field private f:Ljava/util/Comparator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Comparator<",
            "Les/s80;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .line 1
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v1, Lcom/estrongs/fs/util/f;->a:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v1, "/task/tasks.rpt"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Les/t80;->g:Ljava/lang/String;

    const/4 v0, 0x0

    .line 2
    sput-object v0, Les/t80;->h:Les/t80;

    return-void
.end method

.method private constructor <init>()V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Les/t80;->a:Ljava/util/ArrayList;

    .line 3
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    .line 4
    new-instance v0, Landroid/util/SparseArray;

    invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V

    iput-object v0, p0, Les/t80;->c:Landroid/util/SparseArray;

    const/4 v0, 0x0

    .line 5
    iput-object v0, p0, Les/t80;->d:Les/t80$c;

    .line 6
    new-instance v0, Les/t80$a;

    invoke-direct {v0, p0}, Les/t80$a;-><init>(Les/t80;)V

    iput-object v0, p0, Les/t80;->e:Les/z80;

    .line 7
    new-instance v0, Les/t80$b;

    invoke-direct {v0, p0}, Les/t80$b;-><init>(Les/t80;)V

    iput-object v0, p0, Les/t80;->f:Ljava/util/Comparator;

    .line 8
    invoke-direct {p0}, Les/t80;->c()V

    return-void
.end method

.method private a(Lorg/json/JSONObject;)Les/s80;
    .locals 2

    const-string v0, "task_type"

    .line 13
    invoke-virtual {p1, v0}, Lorg/json/JSONObject;->optInt(Ljava/lang/String;)I

    move-result v0

    const/4 v1, 0x6

    if-ne v1, v0, :cond_0

    .line 14
    new-instance v0, Les/d70;

    invoke-static {}, Lcom/estrongs/fs/f;->d()Lcom/estrongs/fs/f;

    move-result-object v1

    invoke-direct {v0, v1, p1}, Les/d70;-><init>(Lcom/estrongs/fs/f;Lorg/json/JSONObject;)V

    goto :goto_0

    :cond_0
    const/16 v1, 0x17

    if-ne v1, v0, :cond_1

    .line 15
    new-instance v0, Les/j70;

    invoke-static {}, Lcom/estrongs/fs/f;->d()Lcom/estrongs/fs/f;

    move-result-object v1

    invoke-direct {v0, v1, p1}, Les/j70;-><init>(Lcom/estrongs/fs/f;Lorg/json/JSONObject;)V

    goto :goto_0

    .line 16
    :cond_1
    new-instance v0, Les/s80;

    invoke-direct {v0, p1}, Les/s80;-><init>(Lorg/json/JSONObject;)V

    :goto_0
    return-object v0
.end method

.method private static a(Ljava/util/List;)Lorg/json/JSONArray;
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lorg/json/JSONObject;",
            ">;)",
            "Lorg/json/JSONArray;"
        }
    .end annotation

    .line 10
    new-instance v0, Lorg/json/JSONArray;

    invoke-direct {v0}, Lorg/json/JSONArray;-><init>()V

    .line 11
    :try_start_0
    invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p0

    :goto_0
    invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/json/JSONObject;

    .line 12
    invoke-virtual {v0, v1}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    :cond_0
    return-object v0
.end method

.method public static declared-synchronized b()Les/t80;
    .locals 2

    const-class v0, Les/t80;

    monitor-enter v0

    .line 1
    :try_start_0
    sget-object v1, Les/t80;->h:Les/t80;

    if-nez v1, :cond_0

    .line 2
    new-instance v1, Les/t80;

    invoke-direct {v1}, Les/t80;-><init>()V

    sput-object v1, Les/t80;->h:Les/t80;

    .line 3
    :cond_0
    sget-object v1, Les/t80;->h:Les/t80;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit v0

    return-object v1

    :catchall_0
    move-exception v1

    monitor-exit v0

    throw v1
.end method

.method private c()V
    .locals 5

    .line 6
    :try_start_0
    sget-object v0, Les/t80;->g:Ljava/lang/String;

    invoke-static {v0}, Lcom/estrongs/fs/util/f;->n(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    .line 7
    invoke-static {v0}, Lcom/estrongs/android/util/o0;->a(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_0

    return-void

    .line 8
    :cond_0
    new-instance v1, Lorg/json/JSONArray;

    invoke-direct {v1, v0}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    const/4 v0, 0x0

    .line 9
    :goto_0
    invoke-virtual {v1}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-ge v0, v2, :cond_2

    .line 10
    invoke-virtual {v1, v0}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;

    move-result-object v2

    if-nez v2, :cond_1

    goto :goto_1

    .line 11
    :cond_1
    iget-object v3, p0, Les/t80;->a:Ljava/util/ArrayList;

    monitor-enter v3
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 12
    :try_start_1
    iget-object v4, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-virtual {v4, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 13
    monitor-exit v3
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 14
    :try_start_2
    invoke-direct {p0, v2}, Les/t80;->a(Lorg/json/JSONObject;)Les/s80;

    move-result-object v2

    .line 15
    invoke-direct {p0, v2}, Les/t80;->d(Les/s80;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    :goto_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :catchall_0
    move-exception v0

    .line 16
    :try_start_3
    monitor-exit v3
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    :try_start_4
    throw v0
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_0

    :catch_0
    :cond_2
    return-void
.end method

.method private c(Les/s80;Z)V
    .locals 7

    .line 17
    iget-object v0, p0, Les/t80;->e:Les/z80;

    invoke-virtual {p1, v0}, Les/s80;->b(Les/z80;)V

    .line 18
    iget-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    if-eqz p2, :cond_0

    .line 19
    invoke-virtual {p1}, Les/s80;->m()I

    move-result p2

    const/4 v0, 0x4

    if-eq p2, v0, :cond_0

    invoke-virtual {p1}, Les/s80;->m()I

    move-result p2

    const/4 v0, 0x5

    if-eq p2, v0, :cond_0

    .line 20
    invoke-virtual {p1}, Les/s80;->s()V

    .line 21
    :cond_0
    iget-object p2, p0, Les/t80;->b:Ljava/util/ArrayList;

    invoke-virtual {p2, p1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z

    goto :goto_0

    .line 22
    :cond_1
    iget-object p2, p0, Les/t80;->c:Landroid/util/SparseArray;

    invoke-virtual {p1}, Les/s80;->n()I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/util/SparseArray;->get(I)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Ljava/util/List;

    if-eqz p2, :cond_2

    .line 23
    invoke-interface {p2, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 24
    :cond_2
    :goto_0
    iget-object p2, p0, Les/t80;->a:Ljava/util/ArrayList;

    monitor-enter p2

    .line 25
    :try_start_0
    iget-object v0, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_3
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_4

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/json/JSONObject;

    .line 26
    invoke-virtual {p1}, Les/s80;->k()J

    move-result-wide v2

    const-string v4, "task_id"

    invoke-virtual {v1, v4}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;)J

    move-result-wide v4

    cmp-long v6, v2, v4

    if-nez v6, :cond_3

    .line 27
    iget-object p1, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-virtual {p1, v1}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z

    .line 28
    monitor-exit p2

    return-void

    .line 29
    :cond_4
    monitor-exit p2

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method

.method private d()V
    .locals 6

    const/4 v0, 0x0

    .line 3
    :try_start_0
    iget-object v1, p0, Les/t80;->a:Ljava/util/ArrayList;

    monitor-enter v1
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_2

    .line 4
    :try_start_1
    iget-object v2, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-static {v2}, Les/t80;->a(Ljava/util/List;)Lorg/json/JSONArray;

    move-result-object v2

    .line 5
    new-instance v3, Ljava/io/File;

    sget-object v4, Les/t80;->g:Ljava/lang/String;

    invoke-direct {v3, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 6
    invoke-virtual {v3}, Ljava/io/File;->exists()Z

    move-result v4

    if-nez v4, :cond_0

    .line 7
    sget-object v3, Les/t80;->g:Ljava/lang/String;

    invoke-static {v3}, Lcom/estrongs/fs/util/f;->d(Ljava/lang/String;)Ljava/io/File;

    move-result-object v3

    .line 8
    :cond_0
    new-instance v4, Ljava/io/OutputStreamWriter;

    new-instance v5, Ljava/io/FileOutputStream;

    invoke-direct {v5, v3}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    invoke-direct {v4, v5}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    .line 9
    :try_start_2
    invoke-virtual {v2}, Lorg/json/JSONArray;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v4, v0}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V

    .line 10
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 11
    invoke-static {v4}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    goto :goto_1

    :catchall_0
    move-exception v2

    move-object v0, v4

    goto :goto_0

    :catchall_1
    move-exception v2

    .line 12
    :goto_0
    :try_start_3
    monitor-exit v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    :try_start_4
    throw v2
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0
    .catchall {:try_start_4 .. :try_end_4} :catchall_2

    :catchall_2
    move-exception v1

    .line 13
    invoke-static {v0}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    .line 14
    throw v1

    .line 15
    :catch_0
    invoke-static {v0}, Lcom/estrongs/fs/util/f;->a(Ljava/io/Closeable;)V

    :goto_1
    return-void
.end method

.method private d(Les/s80;)V
    .locals 1

    .line 1
    iget-object v0, p0, Les/t80;->e:Les/z80;

    invoke-virtual {p1, v0}, Les/s80;->a(Les/z80;)V

    .line 2
    iget-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    return-void
.end method


# virtual methods
.method public a()Ljava/util/List;
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Les/s80;",
            ">;"
        }
    .end annotation

    .line 17
    iget-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    iget-object v1, p0, Les/t80;->f:Ljava/util/Comparator;

    invoke-static {v0, v1}, Ljava/util/Collections;->sort(Ljava/util/List;Ljava/util/Comparator;)V

    .line 18
    iget-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    return-object v0
.end method

.method public declared-synchronized a(Les/s80;)V
    .locals 1

    monitor-enter p0

    const/4 v0, 0x1

    .line 1
    :try_start_0
    invoke-virtual {p0, p1, v0}, Les/t80;->a(Les/s80;Z)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 2
    monitor-exit p0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public declared-synchronized a(Les/s80;Z)V
    .locals 1

    monitor-enter p0

    .line 3
    :try_start_0
    iget-object v0, p0, Les/t80;->b:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_1

    .line 4
    invoke-direct {p0, p1}, Les/t80;->d(Les/s80;)V

    .line 5
    iget-object v0, p0, Les/t80;->d:Les/t80$c;

    if-eqz v0, :cond_0

    if-eqz p2, :cond_0

    .line 6
    iget-object p2, p0, Les/t80;->d:Les/t80$c;

    invoke-interface {p2, p1}, Les/t80$c;->b(Les/s80;)V

    .line 7
    :cond_0
    invoke-virtual {p0, p1}, Les/t80;->c(Les/s80;)V

    goto :goto_0

    .line 8
    :cond_1
    iget-object p2, p0, Les/t80;->e:Les/z80;

    invoke-virtual {p1, p2}, Les/s80;->a(Les/z80;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 9
    :goto_0
    monitor-exit p0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method public a(Les/t80$c;)V
    .locals 0

    .line 19
    iput-object p1, p0, Les/t80;->d:Les/t80$c;

    return-void
.end method

.method public b(Les/s80;)V
    .locals 1

    const/4 v0, 0x1

    .line 4
    invoke-virtual {p0, p1, v0}, Les/t80;->b(Les/s80;Z)V

    return-void
.end method

.method public b(Les/s80;Z)V
    .locals 1

    const/4 v0, 0x0

    .line 5
    invoke-direct {p0, p1, v0}, Les/t80;->c(Les/s80;Z)V

    .line 6
    iget-object v0, p0, Les/t80;->d:Les/t80$c;

    if-eqz v0, :cond_0

    if-eqz p2, :cond_0

    .line 7
    invoke-interface {v0, p1}, Les/t80$c;->a(Les/s80;)V

    .line 8
    :cond_0
    invoke-direct {p0}, Les/t80;->d()V

    return-void
.end method

.method public c(Les/s80;)V
    .locals 3

    .line 1
    iget-object v0, p0, Les/t80;->a:Ljava/util/ArrayList;

    monitor-enter v0

    .line 2
    :try_start_0
    iget-object v1, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-virtual {p1}, Les/s80;->w()Lorg/json/JSONObject;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    .line 3
    iget-object v1, p0, Les/t80;->a:Ljava/util/ArrayList;

    invoke-virtual {p1}, Les/s80;->w()Lorg/json/JSONObject;

    move-result-object p1

    invoke-virtual {v1, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 4
    :cond_0
    invoke-direct {p0}, Les/t80;->d()V

    .line 5
    monitor-exit v0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method
